package com.atguigu.guli.service.statistics.task;

import com.atguigu.guli.service.statistics.service.DailyService;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class StatisticsTask {

    @Autowired
    DailyService dailyService;

    /*
    定时生成报表信息
     */
    @Scheduled(cron = "0 0 2 * * ?")
    public void createDaily(){
        String day = new DateTime().minusDays(1).toString("yyyy-MM-dd");
        dailyService.genDaily(day);
    }
}
